<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../jQuery/jquery-1.9.1.min.js"></script>
</head>
<style>
    li{
        display: inline-block;
        float: left;
    }
</style>
<body>
<input type="text" placeholder="起始时间" id="up">
<input type="text" placeholder="结束时间" id="noUp">
<button type="button" id="btn">开始</button>
<ul class="dataUl">

</ul>

<script>
    Date.prototype.format = function() {
        var s = '';
        var mouth = (this.getMonth() + 1)>=10?(this.getMonth() + 1):('0'+(this.getMonth() + 1));
        var day = this.getDate()>=10?this.getDate():('0'+this.getDate());
        s += this.getFullYear() + '-'; // 获取年份。
        s += mouth + "-"; // 获取月份。
        s += day; // 获取日。
        return (s); // 返回日期。
    };
    function getAll(begin, end) {
        var ab = begin.split("-");
        var ae = end.split("-");
        var db = new Date();
        db.setUTCFullYear(ab[0], ab[1] - 1, ab[2]);
        var de = new Date();
        de.setUTCFullYear(ae[0], ae[1] - 1, ae[2]);
        var unixDb = db.getTime();
        var unixDe = de.getTime();
        for (var k = unixDb; k <= unixDe;) {
            $(".dataUl").append("<li>"+(new Date(parseInt(k))).format()+"</li>");
            k = k + 24 * 60 * 60 * 1000;
        }
    }
    $("#btn").on('click',function () {
        var up =$("#up").val();
        var noUp = $("#noUp").val();
        getAll(up,noUp)
    });

    //2017-02-27  2017-02-28 2017-03-01 2017-03-02

</script>
</body>
</html>

